<?php
namespace catchAdmin\archives\tables;

use catchAdmin\archives\tables\forms\Factory;
use catcher\CatchTable;
use catcher\library\table\Actions;
use catcher\library\table\HeaderItem;
use catcher\library\table\Search;

class History extends CatchTable
{
    protected function form()
    {
        // TODO: Implement form() method.
        return Factory::create('history');
    }

    protected function table()
    {
        // TODO: Implement table() method.
        return $this->getTable('History')
                    ->header([
                        HeaderItem::label()->selection(),
                        //HeaderItem::label('编号')->prop('id')->width(80)->dontExport(),
                        HeaderItem::label('患者ID')->prop('patient_id'),
                        HeaderItem::label('姓名')->prop('name'),
                        HeaderItem::label('过敏史')->prop('irritability'),
                        HeaderItem::label('手术史')->prop('operation'),
                        HeaderItem::label('生育史')->prop('give_birth'),
                        HeaderItem::label('月经史')->prop('menstruation'),
                        HeaderItem::label('创建时间')->prop('created_at')->dontExport(),
                        HeaderItem::label('操作')->actions([
                            Actions::update(),
                            Actions::delete()
                        ])
                    ])
                    ->withActions([
                        Actions::create(),
                        Actions::import()
                    ])
                    ->withImportRoute('/historys/import')
                    ->withDialogWidth('35%')
                    ->withApiRoute('history')
                    ->selectionChange()
                    ->render();
    }
}